package com.example.tse.rbyair.PKhome;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Looper;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.tse.rbhttpservice.service.RemoteServiceFactory;
import com.example.tse.rbhttpservice.service.RemoteServiceListenerT;
import com.example.tse.rbhttpservice.service.common.model.CommonGetADList;
import com.example.tse.rbhttpservice.service.common.model.CommonGetADListRequest;
import com.example.tse.rbhttpservice.service.common.model.CommonGetADListResponse;
import com.example.tse.rbhttpservice.service.goods.model.GoodsGetSimilarList;
import com.example.tse.rbhttpservice.service.goods.model.GoodsGetSimilarListRequest;
import com.example.tse.rbhttpservice.service.goods.model.GoodsGetSimilarListResponse;
import com.example.tse.rbhttpservice.service.goods.model.GoodsGetVirtualCatListRequest;
import com.example.tse.rbhttpservice.service.goods.model.GoodsGetVirtualCatListResponse;
import com.example.tse.rbhttpservice.service.home.model.HomeGetSecondRequest;
import com.example.tse.rbhttpservice.service.home.model.HomeGetSecondResponse;
import com.example.tse.rbhttpservice.service.home.model.HomeGetSpecialsRequest;
import com.example.tse.rbhttpservice.service.home.model.HomeGetSpecialsResponse;
import com.example.tse.rbyair.PKhome.adapter.MainFragmentStatePagerAdapter;
import com.example.tse.rbyair.PKhome.adapter.MainNewListAdapter;
import com.example.tse.rbyair.PKhome.model.HoltsaleBanner;
import com.example.tse.rbyair.PKhome.model.MainVo;
import com.example.tse.rbyair.R;
import com.example.tse.rbyair.util.RbImageLoader;
import com.example.tse.rbyair.widget.imagecycleview.ADInfo;
import com.example.tse.rbyair.widget.imagecycleview.ImageCycleView;
import com.example.tse.rbyair.widget.others.CustomDigitalClock;
import com.viewpagerindicator.CirclePageIndicator;

import org.kymjs.kjframe.log.L;
import org.kymjs.kjframe.utils.DensityUtils;

import java.util.ArrayList;
import java.util.List;


/**
 * Created by tse on 2015/11/25.
 */
@SuppressLint("ValidFragment")
public class HomeFragment extends Fragment {
    ImageCycleView mainBanner;
    ViewPager viewpager;
    CirclePageIndicator circlepageindicator;
    RelativeLayout viewpagerLay;
    TextView secondtitle;
    ImageView secondoneIv;
    TextView timerTxt1;
    CustomDigitalClock timerView;
    TextView secondoneButton;
    RelativeLayout secondoneLay;
    ImageView secondtwoIv;
    TextView timerTxt2;
    LinearLayout timerLay2;
    RelativeLayout secondtwoLay;
    LinearLayout secondLay;
    private View header;
    private ListView main_list;
    private List<MainVo> lists ;
    private MainNewListAdapter adapter;
    //    private HomeGetSortSecond secondsOne;
//    private HomeGetSortSecond secondsTwo;
    private String productOneId = "";
    private String productTwoId = "";
    private CommonGetADList getADList;
    private MainFragmentStatePagerAdapter statePageAdapter;
//    private boolean isrefresh = false;
    private int w;

    public HomeFragment() {

    }

    @Override
    public void setMenuVisibility(boolean menuVisible) {
        super.setMenuVisibility(menuVisible);
        if (this.getView() != null) {
            this.getView().setVisibility(menuVisible ? View.VISIBLE : View.GONE);
        }
    }



    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        lists = new ArrayList<MainVo>();
    }


    @Override
    public String toString() {
        return super.toString();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        return inflater.inflate(R.layout.mainfragment_4, null);
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        main_list = (ListView) view.findViewById(R.id.main_list);

        header = LayoutInflater.from(getActivity()).inflate(R.layout.mainfragment4_header, null);
        mainBanner = (ImageCycleView)header.findViewById(R.id.main_banner);
        viewpager = (ViewPager)header.findViewById(R.id.viewpager);
        circlepageindicator = (CirclePageIndicator)header.findViewById(R.id.circlepageindicator);
        viewpagerLay = (RelativeLayout)header.findViewById(R.id.viewpager_lay);
        secondtitle = (TextView)header.findViewById(R.id.secondtitle);
        secondoneIv = (ImageView)header.findViewById(R.id.secondone_iv);
        timerTxt1 = (TextView)header.findViewById(R.id.timer_txt1);
        timerView = (CustomDigitalClock)header.findViewById(R.id.timerView);
        secondoneButton = (TextView)header.findViewById(R.id.secondone_button);
//        secondoneLay = (RelativeLayout)header.findViewById(R.id.secondone_lay);
        secondtwoIv = (ImageView)header.findViewById(R.id.secondtwo_iv);
        timerTxt2 = (TextView)header.findViewById(R.id.timer_txt2);
        timerLay2 = (LinearLayout)header.findViewById(R.id.timer_lay2);
        secondtwoLay = (RelativeLayout)header.findViewById(R.id.secondtwo_lay);
        secondLay = (LinearLayout)header.findViewById(R.id.second_lay);

        w = DensityUtils.getScreenW(getActivity());
        LinearLayout.LayoutParams ivlp = new LinearLayout.LayoutParams(w, w/2);
        mainBanner.setLayoutParams(ivlp);

        adapter = new MainNewListAdapter(getActivity());



        main_list.addHeaderView(header);
        main_list.setAdapter(adapter);

        getAdList();
        getCategaryList();
        getSimilarList();


    }

    //广告banner
    private void getAdList() {
        CommonGetADListRequest adReauest = new CommonGetADListRequest() {
            @Override
            public String givePosition() {
                return "14";
            }

            @Override
            public String giveVirtualCatId() {
                return "";
            }
        };

        RemoteServiceFactory.getInstance().getCommonService(getActivity()).getADList(adReauest, new RemoteServiceListenerT<CommonGetADListResponse>() {

            @Override
            public void okData(CommonGetADListResponse commonGetADListResponse) {
                super.okData(commonGetADListResponse);
                final List<CommonGetADList> commonGetADList = commonGetADListResponse.getGetADList();
                ArrayList<ADInfo> adList = new ArrayList<ADInfo>();

                for (int i = 0; i < commonGetADList.size(); i++) {
                    ADInfo ad = new ADInfo();
                    CommonGetADList getADList = commonGetADList.get(i);
                    ad.setUrl(getADList.getImg());
                    ad.setType(getADList.getBannerType());
                    adList.add(ad);
                }

                if (adList.size() > 0) {

                    mainBanner.setImageResources(adList, new ImageCycleView.ImageCycleViewListener() {

                        @Override
                        public void onImageClick(ADInfo info, int postion, View imageView) {
                            getADList = commonGetADList.get(postion);
                            // TODO 统计
//                            if (info.getType().equals("h5link")) {
//                                Intent intentWeb = new Intent(getActivity(), WebViewDetail.class);
//                                //								intentWeb.putExtra("target", getADList.getTarget());
//                                if (getADList.getTarget().contains("?")) {
//                                    intentWeb.putExtra("target", getADList.getTarget() + "&rudder_position=" + IntegrateConst.SORT_AD_POSITION + (postion + 1) + "&rudder_route=" + IntegrateConst.NEW_SORT_ROUTE
//                                            + "&rudder_appType=" + "android" + "&rudder_market=" + AppInforUtil.market + "&rudder_deviceId=" + AppInforUtil.getDeviceId(getActivity())
//                                            + "&rudder_deviceInfo=" + AppInforUtil.getInfo(getActivity())
//                                            + "&rudder_activityId=" + AppInforUtil.getInstance().getActivityId());
//                                } else {
//                                    intentWeb.putExtra("target", getADList.getTarget() + "?rudder_position=" + IntegrateConst.SORT_AD_POSITION + (postion + 1) + "&rudder_route=" + IntegrateConst.NEW_SORT_ROUTE
//                                            + "&rudder_appType=" + "android" + "&rudder_market=" + AppInforUtil.market + "&rudder_deviceId=" + AppInforUtil.getDeviceId(getActivity())
//                                            + "&rudder_deviceInfo=" + AppInforUtil.getInfo(getActivity())
//                                            + "&rudder_activityId=" + AppInforUtil.getInstance().getActivityId());
//                                }
//                                startActivity(intentWeb);
//                            } else if (info.getType().equals("goods")) {
//                                // TODO
//                                Intent intentGoods = new Intent(getActivity(), ProductDetialActivity2.class);
//                                intentGoods.putExtra("productId", getADList.getTarget());
//                                intentGoods.putExtra("rudder_position", IntegrateConst.SORT_AD_POSITION + (postion + 1));
//                                intentGoods.putExtra("rudder_route", IntegrateConst.NEW_SORT_ROUTE);
//                                startActivity(intentGoods);
//                            } else if (info.getType().equals("special")) {
//                                Intent intentGroup = new Intent(getActivity(), SortSpecialActivity.class);
//                                intentGroup.putExtra("rudder_position", IntegrateConst.SORT_AD_POSITION + (postion + 1));
//                                intentGroup.putExtra("rudder_route", IntegrateConst.NEW_SORT_ROUTE);
//                                intentGroup.putExtra("similarId", getADList.getTarget());
//                                startActivity(intentGroup);
//                            } else if (info.getType().equals("moments")) {
//                                Intent intentMoments = new Intent(getActivity(), CircleFragment2.class);
//                                startActivity(intentMoments);
//                            } else if (info.getType().equals("pinhaohuo")) {
//                                Intent intent = new Intent(getActivity(), MainActivity.class);
//                                intent.putExtra("TURNBACKFIRST", "1");
//                                startActivity(intent);
//                            } else if (info.getType().equals("group")) {
//                                Intent intent = new Intent(getActivity(), MainActivity.class);
//                                intent.putExtra("TURNBACKFIRST", "1");
//                                startActivity(intent);
//                            } else if (info.getType().equals("img")) {
//                                return;
//                            } else {
//                                return;
//                            }
                        }

                        @Override
                        public void displayImage(String imageURL, ImageView imageView) {
                            RbImageLoader.displayImage(imageURL, imageView, RbImageLoader.getBannerOptions());
                        }
                    });
                }

            }

            @Override
            public void Finish() {
                super.Finish();

//                getCategaryList();

            }
        });
    }

    private void getHomeSeconds(){

        HomeGetSecondRequest secondReq = new HomeGetSecondRequest() {
        };
        RemoteServiceFactory.getInstance().getHomeService(getActivity()).getSecond(secondReq, new RemoteServiceListenerT<HomeGetSecondResponse>() {
            @Override
            public void okData(HomeGetSecondResponse homeGetSecondResponse) {
                super.okData(homeGetSecondResponse);

            }
        });
    }

    // 精选列表
    private void getCategaryList() {
        GoodsGetVirtualCatListRequest categaryReq = new GoodsGetVirtualCatListRequest() {
        };
        RemoteServiceFactory.getInstance().getGoodsService(getActivity()).getVirtualCatList(categaryReq, new RemoteServiceListenerT<GoodsGetVirtualCatListResponse>() {
            @Override
            public void okData(GoodsGetVirtualCatListResponse goodsGetVirtualCatListResponse) {
                super.okData(goodsGetVirtualCatListResponse);
                L.d("hp", "HomeFragment categaryReq:" + goodsGetVirtualCatListResponse.getList().size());

                statePageAdapter = new MainFragmentStatePagerAdapter(getFragmentManager(), goodsGetVirtualCatListResponse.getList());
                viewpager.setAdapter(statePageAdapter);

                if (goodsGetVirtualCatListResponse.getList().size() > 4) {
                    circlepageindicator.setViewPager(viewpager);
                }

                Boolean isMAinThread = Looper.myLooper() == Looper.getMainLooper();
                L.d("hp","HomeFragment SecondClassifyActivity isMAinThread::"+isMAinThread);

//                if (!isrefresh) {
//                    main_list.addHeaderView(header);
//                    isrefresh = true;
//                }

//                main_list.setAdapter(adapter);
            }

            @Override
            public void Finish() {
                super.Finish();


            }
        });
    }

    //秒杀
//    private void getSeconds(){
//        HomeGetSecondRequest secondReq = new HomeGetSecondRequest() {
//        };
//        RemoteServiceFactory.getInstance().getHomeService(getActivity()).getSecond(secondReq, new RemoteServiceListenerT<HomeGetSecondResponse>() {
//            @Override
//            public void okData(HomeGetSecondResponse homeGetSecondResponse, int fromWhere) {
//                super.okData(homeGetSecondResponse, fromWhere);
//
//
//                //没数据的时候影藏秒杀
//                if(t.size() == 0){
//                    secondLay.setVisibility(View.GONE);
//                    secondtitle.setVisibility(View.GONE);
//                }else{
//                    secondLay.setVisibility(View.VISIBLE);
//                    secondtitle.setVisibility(View.VISIBLE);
//                }
//
//                if(t.size()>0){
//                    RbImageLoader.displayImage(t.get(0).getMainImage(), DensityUtils.dip2px(getActivity(), 4), secondoneIv);
//
//                    secondsOne = t.get(0);
//                    productOneId = secondsOne.getProductId();
//                    if(((Long.parseLong(secondsOne.getBeginTime())) * 1000-(Long.parseLong(secondsOne.getCurrentTime())) * 1000)>0 ){  //倒计时还没开始
//                        RbLog.i("倒计时还没开始");
//                        timerView.setVisibility(8);
//                        timer_txt1.setVisibility(0);
//                        timer_txt1.setText(""+CommonUtils.transferLongToDate("HH:mm:ss",(Long.parseLong(secondsOne.getBeginTime())) * 1000)+"准时开抢");
//
//                        new Handler().postDelayed(new Runnable() {
//
//                            @Override
//                            public void run() {
//                                RbLog.i("倒计时开始");
//                                second_lay.invalidate();
//                                getSortSecond();
//                            }
//                        }, (Long.parseLong(secondsOne.getBeginTime())) * 1000-(Long.parseLong(secondsOne.getCurrentTime())) * 1000);
//
//                        if(secondsOne.getHasNoticed().equals("1")){  // 取消提醒
//                            secondone_button.setText("取消提醒");
//                            secondone_button.setTextColor(getResources().getColor(R.color.gry_font));
//                            Drawable drawable= getResources().getDrawable(R.drawable.classification_icon_cancelremind);
//                            drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
//                            secondone_button.setCompoundDrawablePadding(CommonUtils.dip2px(getActivity(), 4));
//                            secondone_button.setCompoundDrawables(drawable,null,null,null);
//                        }else{
//                            secondone_button.setText("设置提醒");
//                            secondone_button.setTextColor(getResources().getColor(R.color.pink_font));
//                            Drawable drawable= getResources().getDrawable(R.drawable.classification_icon_remind);
//                            drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
//                            secondone_button.setCompoundDrawablePadding(CommonUtils.dip2px(getActivity(), 4));
//                            secondone_button.setCompoundDrawables(drawable,null,null,null);
//                        }
//                        secondone_button.setOnClickListener(new OnClickListener() {
//
//                            @Override
//                            public void onClick(View arg0) {
//
//                                if(SharedPreferenceUtils.getValueByKey(getActivity(), "memberId").equals("")){
//                                    Toast.makeText(getActivity(), "请先登录", 0).show();
//                                    Intent intent1 = new Intent(getActivity(), LoginActivity.class);
//                                    intent1.putExtra("type", "1");
//                                    startActivity(intent1);
//                                }else{
//
//                                    if(secondsOne.getHasNoticed().equals("1")){  //  取消
//                                        secondsOne.setHasNoticed("0");
//                                        secondone_button.setText("设置提醒");
//                                        secondone_button.setTextColor(getResources().getColor(R.color.pink_font));
//                                        Drawable drawable= getResources().getDrawable(R.drawable.classification_icon_remind);
//                                        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
//                                        secondone_button.setCompoundDrawablePadding(CommonUtils.dip2px(getActivity(), 4));
//                                        secondone_button.setCompoundDrawables(drawable,null,null,null);
//                                        notice("0");
//                                    }else{  //开启
//                                        secondsOne.setHasNoticed("1");
//                                        secondone_button.setText("取消提醒");
//                                        secondone_button.setTextColor(getResources().getColor(R.color.gry_font));
//                                        Drawable drawable= getResources().getDrawable(R.drawable.classification_icon_cancelremind);
//                                        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
//                                        secondone_button.setCompoundDrawablePadding(CommonUtils.dip2px(getActivity(), 4));
//                                        secondone_button.setCompoundDrawables(drawable,null,null,null);
//                                        notice("1");
//                                    }
//                                }
//
//                            }
//                        });
//                        RbLog.i("倒计时还没开始");
//                    }else{
//                        timerView.setVisibility(0);
//                        timeGap = Long.parseLong(secondsOne.getCurrentTime()) * 1000-System.currentTimeMillis();
//                        timerView.setTimeGap(timeGap);
//                        timerView.setEndTime(Long.parseLong(secondsOne.getEndTime())*1000);
//                        timerView.setClockListener(new ClockListener() {
//
//                            @Override
//                            public void timeEnd() {
//                                //						timerView.setVisibility(8);
//                                //						seckill_endtime.setVisibility(8);
//                                //						seckill_buynow.setVisibility(8);
//                                //						seckill_unstarttxt.setVisibility(0);
//                                //						seckill_unstarttxt.setText(""+CommonUtils.transferLongToDate("HH:mm",((long)secondsOne.getBeginTime()) * 1000)+"准时开抢");
//                                secondsOne = null;
//                                second_lay.invalidate();
//                                getSortSecond();
//                                RbLog.i("倒计时到点");
//                            }
//
//                            @Override
//                            public void remainFiveMinutes() {
//
//                            }
//                        });
//                        timer_txt1.setVisibility(0);
//                        timer_txt1.setText("仅剩");
//
//                        secondone_button.setText("立即抢购");
//                        secondone_button.setTextColor(getResources().getColor(R.color.pink_font));
//                        secondone_button.setCompoundDrawables(null,null,null,null);
//                        secondone_button.setOnClickListener(new OnClickListener() {
//
//                            @Override
//                            public void onClick(View arg0) {
//                                if(!productOneId.equals("") && productOneId !=null){
//                                    Intent intent = new Intent(getActivity(), ProductDetialActivity2.class);
//                                    intent.putExtra("productId", productOneId);
//                                    intent.putExtra("rudder_position", (IntegrateConst.NEW_POSITION_SECKILL_ONE));
//                                    intent.putExtra("rudder_route", IntegrateConst.NEW_SORT_ROUTE);
//                                    intent.putExtra("secondId", ""+secondsOne.getSecondId());
//                                    intent.putExtra("relativeId", ""+secondsOne.getSecondId());
//                                    intent.putExtra("isFastBuy", "2");
//                                    intent.putExtra("type", "2");
//
//                                    Bundle b = new Bundle();
//                                    b.putSerializable("secondsMode", secondsOne);
//                                    intent.putExtras(b);
//
//                                    intent.putExtra("timeGap", timeGap);
//                                    intent.putExtra("deviceId", CommonUtils.getDeviceId(getActivity()));
//                                    if(((Long.parseLong(secondsOne.getBeginTime())) * 1000-(Long.parseLong(secondsOne.getCurrentTime())) * 1000)>0 ){
//                                        //未开抢
//                                        intent.putExtra("开抢", "0");
//                                    }else{
//                                        intent.putExtra("开抢", "1");
//                                    }
//                                    startActivity(intent);
//                                }
//                            }
//                        });
//
//                        RbLog.i("倒计时开始");
//                    }
//
//                    if(!TextUtils.isEmpty(t.get(0).getStoreNum()) && t.get(0).getStoreNum().equals("0")){
//                        secondone_button.setText("已售罄");
//                        secondone_button.setTextColor(getResources().getColor(R.color.gry_font));
//                        secondone_button.setCompoundDrawables(null,null,null,null);
//                    }
//                }
//
//                if(t.size()>1){
//                    RbImageLoader.displayImageSecond(t.get(1).getMainImage(), CommonUtils.dip2px(getActivity(), 4), secondtwo_iv);
//                    t.get(1).getBeginTime();
//                    timer_txt2.setText(CommonUtils.transferLongToDate("HH",(Long.parseLong(t.get(1).getBeginTime())) * 1000)+"点开抢");
//                    secondsTwo = t.get(1);
//                    productTwoId = secondsTwo.getProductId();
//                }else if(t.size() == 1){
//                    RbImageLoader.displayImageSecond("", CommonUtils.dip2px(getActivity(), 4), secondtwo_iv);
//                    //			timer_txt2.setText(CommonUtils.transferLongToDate("HH",(Long.parseLong(t.get(1).getBeginTime())) * 1000)+"点开抢");
//                    //			timer_txt2.setText("00:00开抢");
//                    timer_lay2.setVisibility(8);
//                    secondsTwo = null;
//                    productTwoId = "";
//                }
//
//
//            }
//        });
//    }


    //精品
    private void getSimilarList() {
        GoodsGetSimilarListRequest similarRequest = new GoodsGetSimilarListRequest() {
        };
        RemoteServiceFactory.getInstance().getGoodsService(getActivity()).getSimilarList(similarRequest, new RemoteServiceListenerT<GoodsGetSimilarListResponse>() {
            @Override
            public void okData(GoodsGetSimilarListResponse goodsGetSimilarListResponse) {
                super.okData(goodsGetSimilarListResponse);
//                lists.clear();
                L.d("hp", "HomeFragment getSimilarList=" + goodsGetSimilarListResponse.getGetSimilarList().size());
                List<GoodsGetSimilarList> SimilarList = goodsGetSimilarListResponse.getGetSimilarList();

                for (GoodsGetSimilarList ggsl : goodsGetSimilarListResponse.getGetSimilarList()) {
                    MainVo mv = new MainVo();
                    mv.setType("similar");
                    mv.setSimilar(ggsl);
                    lists.add(mv);
                }
                getSpecials();
            }
        });

    }

    // 热卖
    private void getSpecials() {
        HomeGetSpecialsRequest r = new HomeGetSpecialsRequest() {
        };
        RemoteServiceFactory.getInstance().getHomeService(getActivity()).getSpecials(r, new RemoteServiceListenerT<HomeGetSpecialsResponse>() {
            @Override
            public void okData(HomeGetSpecialsResponse homeGetSpecialsResponse) {
                super.okData(homeGetSpecialsResponse);


                L.d("hp", "HomeFragment :" + homeGetSpecialsResponse.getGetSpecials().size());
                int size = homeGetSpecialsResponse.getGetSpecials().size();
                if (size > 0) {
                    MainVo mv0 = new MainVo();
                    mv0.setType("holtsale_title");
                    lists.add(mv0);
                }

                int m = 1;
                int m1 = 1;
                for (int i = 0; i < size; i++) {

                    int size2 = homeGetSpecialsResponse.getGetSpecials().get(i).getGoods().size();

                    for (int j = 0; j < size2; j++) {
                        MainVo mv2 = new MainVo();
                        mv2.setHoltsale_goods(homeGetSpecialsResponse.getGetSpecials().get(i).getGoods().get(j));
                        mv2.setType("holtsale_goods");

                        mv2.setPosition(m++);
                        lists.add(mv2);
                    }

                    MainVo mv1 = new MainVo();
                    HoltsaleBanner banner = new HoltsaleBanner();
                    banner.setLink(homeGetSpecialsResponse.getGetSpecials().get(i).getLink());
                    banner.setLinkType(homeGetSpecialsResponse.getGetSpecials().get(i).getLinkType());
                    banner.setSpecialId(homeGetSpecialsResponse.getGetSpecials().get(i).getSpecialId());
                    banner.setUrl(homeGetSpecialsResponse.getGetSpecials().get(i).getUrl());
                    mv1.setHoltsale_banner(banner);
                    mv1.setType("holtsale_banner");
                    mv1.setPosition(m1++);
                    lists.add(mv1);
                }

                L.d("hp","HomeFragment adapter.setData(lists, size);:");
                adapter.setData(lists, size);

            }
        });
    }


    @Override
    public void onDestroy() {
        super.onDestroy();

    }

}
